//sku相关的api
import request from "../../../utils/request.ts";
import type {T_SkuResponseData, T_SkuInfoResponseData} from "./type.ts";


enum API {
    //获取已有的商品的数据-SKU
    SKU_URL = "/admin/product/list/",
    //商品上架
    SALE_URL = "/admin/product/onSale/",
    //商品下架
    CANCELSALE_URL = "/admin/product/cancelSale/",
    //获取sku详细信息
    SKUINFO_URL = "/admin/product/getSkuInfo/",
    //删除sku
    DELETESKU_URL = "/admin/product/deleteSku/"
}

//获取sku 接口
export const reqSkuListInfo = (page: number, limit: number) => request.get<any, T_SkuResponseData>(API.SKU_URL + `${page}/${limit}`);

//商品上架
export const reqSaleSku = (skuId: number) => request.get<any, any>(API.SALE_URL + skuId);

//商品下架
export const reqCancelSaleSku = (skuId: number) => request.get<any, any>(API.CANCELSALE_URL + skuId);

//获取sku详细信息
export const reqSkuDetailInfo = (skuId: number) => request.get<any, T_SkuInfoResponseData>(API.SKUINFO_URL + skuId);

//删除已有商品
export const reqRemoveSku = (skuId: number) => request.delete<any, any>(API.DELETESKU_URL + skuId);

